define(['jquery', 'salad'], function (jquery, salad) {
    'use strict';
    /**此方法用于响应导航菜单的切换
     * 其中destination包含了从事件源发过来
     * 消息，消息的格式为{key:xx,value:xx}
     */
    function navTo(destination) {
        salad.hiddeMiddleMainPanel();
        salad.showCategoryPanel();
        var key = destination.key;
        var value = destination.value;
        setRightTitleImg(value);
        setRightTitleText(key);
    }

    function setRightTitleText(title) {
        $("span.salad-categories-right-item-text").text(title);
    }

    function setRightTitleImg(img) {
        $("span.salad-categories-item-img").css("backgroundImage", img);
    }

    return {
         navTo: navTo 
        };
});